package com.im.partchat.ui.fragment;

import android.os.Bundle;
import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.bumptech.glide.Glide;
import com.im.partchat.App;
import com.im.partchat.R;
import com.im.partchat.adapter.MineGirdAdapter;
import com.im.partchat.base.BaseFragment;
import com.im.partchat.bean.main.MainGirdBean;
import com.im.partchat.utils.Navigation;
import com.im.partchat.widget.NoScrollGridView;

import java.util.ArrayList;
import java.util.List;

import butterknife.BindView;
import butterknife.OnClick;

/**
 * Created by fzl on 2017/6/26 0026.
 * VersionCode: 1
 * Desc:
 */

public class MineFragment extends BaseFragment {
    @BindView(R.id.iv_head)
    ImageView ivHead;
    @BindView(R.id.tv_userName)
    TextView tvUserName;
    @BindView(R.id.tv_address)
    TextView tvAddress;
    @BindView(R.id.tv_join_part_text)
    TextView tvJoinPartText;
    @BindView(R.id.tv_join_team_text)
    TextView tvJoinTeamText;
    @BindView(R.id.ll_join)
    LinearLayout llJoin;
    @BindView(R.id.gv_mine)
    NoScrollGridView gvMine;


    private List<MainGirdBean> mainGirdBeanList;
    public MineFragment() {
    }


    @Override
    protected void initView(View view, Bundle savedInstanceState) {
        tvUserName.setText(App.getUserBean().getName());
        Glide.with(this)
                .load(App.getUserBean().getHeadUrl())
                .centerCrop()
                .crossFade()
                .into(ivHead);
        initGridLayout();

    }

    private void initGridLayout() {
        mainGirdBeanList=new ArrayList<>();
        mainGirdBeanList.add(new MainGirdBean(R.drawable.study_icon_1,"政银服务") );
        mainGirdBeanList.add(new MainGirdBean(R.drawable.study_icon_2,"三会一课") );
        mainGirdBeanList.add(new MainGirdBean(R.drawable.study_icon_3,"思想汇报") );
        mainGirdBeanList.add(new MainGirdBean(R.drawable.study_icon_4,"我的活动") );
        mainGirdBeanList.add(new MainGirdBean(R.drawable.study_icon_5,"我的组织") );
        mainGirdBeanList.add(new MainGirdBean(R.drawable.study_icon_6,"转组织关系") );
        mainGirdBeanList.add(new MainGirdBean(R.drawable.study_icon_7,"党费交纳") );
        mainGirdBeanList.add(new MainGirdBean(R.drawable.study_icon_8,"文档模板") );
        gvMine.setAdapter(new MineGirdAdapter(App.getApplication(),mainGirdBeanList));

    }

    @Override
    protected int getLayoutId() {
        return R.layout.fragment_mine;
    }

    @Override
    protected void initData() {

    }

    @Override
    public void onLoadDataSuccess(Object o, String flag) {

    }



    @OnClick({R.id.iv_head, R.id.ll_join})
    public void onViewClicked(View view) {
        switch (view.getId()) {
            case R.id.iv_head:
                break;
            case R.id.ll_join:
                Navigation.navigateMyFoot();
                break;
        }
    }
}
